package main

import (
	"context"
	"fmt"

	"example.com/m/v2/log"
	"example.com/m/v2/registry"
	"example.com/m/v2/service"

	stlog "log"
)

func main() {
	// stlog.Println("hello")
	log.Run("./dis.log")
	host, port := "localhost", "9527"
	ServiceURL := fmt.Sprintf("http://%s:%s", host, port)
	r := registry.Registration{
		ServiceName:      "logService",
		ServiceURL:       ServiceURL,
		RequiredServices: make([]registry.ServiceName, 0),
		ServiceUpdateURL: ServiceURL + "/services",
	}
	ctx, err := service.Start(
		context.Background(),
		host,
		port,
		r,
		log.RegisterHandlers,
	)
	if err != nil {
		stlog.Fatal(err)
	}

	<-ctx.Done()

	fmt.Println("shutdown")
}
